

USE [WebSecurity]
GO

GO
-- Drop stored procedure if it already exists
IF EXISTS (
  SELECT * 
    FROM INFORMATION_SCHEMA.ROUTINES 
   WHERE SPECIFIC_CATALOG = N'WebSecurity' 
	 AND SPECIFIC_SCHEMA = N'dbo'
     AND SPECIFIC_NAME = N'Membership_ins' 
)
   DROP PROCEDURE dbo.Membership_ins
GO
create procedure Membership_ins

	@MembershipID Int = null OUTPUT,
	@ConfirmationToken NVarChar(128),
	@IsConfirmed Bit,
	@LastPasswordFailureDate DateTime,
	@PasswordFailuresSinceLastSuccess Int,
	@Password NVarChar(128),
	@PasswordChangedDate DateTime,
	@PasswordSalt NVarChar(128),
	@PasswordVerificationToken NVarChar(128),
	@PasswordVerificationTokenExpirationDate DateTime,
	@CreatedBy VarChar(50),
	@CreatedDt DateTime,
	@ModifiedBy VarChar(50),
	@ModifiedDt DateTime,
	@EmailAccount NVarChar(255),
	@PasswordAnswer NVarChar(250),
	@LastLoginDate DateTime,
	@LastLockoutDate DateTime,
	@UserId Int,
	@PasswordQuestionID Int,
        @RowsAffected int = null OUTPUT 
	
--*************************************************************
--Created By: trooks
--Name: dbo_Membership_ins
--Schema: dbo
--Table: Membership
--Database: WebSecurity
--Created Date: 01/21/2013 00:00:00
--*************************************************************

as
	Begin Try
        insert into [dbo].Membership
		(
		ConfirmationToken, 
		IsConfirmed, 
		LastPasswordFailureDate, 
		PasswordFailuresSinceLastSuccess, 
		Password, 
		PasswordChangedDate, 
		PasswordSalt, 
		PasswordVerificationToken, 
		PasswordVerificationTokenExpirationDate, 
		CreatedBy, 
		CreatedDt, 
		ModifiedBy, 
		ModifiedDt, 
		EmailAccount, 
		PasswordAnswer, 
		LastLoginDate, 
		LastLockoutDate, 
		UserId, 
		PasswordQuestionID 
    )
    values
    (
		@ConfirmationToken, 
		@IsConfirmed, 
		@LastPasswordFailureDate, 
		@PasswordFailuresSinceLastSuccess, 
		@Password, 
		@PasswordChangedDate, 
		@PasswordSalt, 
		@PasswordVerificationToken, 
		@PasswordVerificationTokenExpirationDate, 
		@CreatedBy, 
		@CreatedDt, 
		@ModifiedBy, 
		@ModifiedDt, 
		@EmailAccount, 
		@PasswordAnswer, 
		@LastLoginDate, 
		@LastLockoutDate, 
		@UserId, 
		@PasswordQuestionID 
        )
		Set @MembershipID = SCOPE_IDENTITY(); 
		Set @RowsAffected = @@ROWCOUNT;
		return 0;	
	END TRY
	BEGIN CATCH
		Set @RowsAffected = 0;
		EXEC dbo.uspLogError;
		return -1;
	END CATCH
	
GO
GRANT EXECUTE ON [WebSecurity].[dbo].[Membership_ins] to PORTAL_WebSecurity
GO




